package BLC

type BlockChain struct {
	Blocks []*Block
}

//2 增加区块到区块链里面
func (blc *BlockChain) AddBlockToBlockchain(data string,height int64,priHash []byte){
	//创建新区快
	newBlock :=NewBlock(data,height,priHash)
	//往区块链添加区块
	blc.Blocks = append(blc.Blocks,newBlock)
}

// 1. 创建带有创世区块的区块链
func CreateBlockchainWithGenesisBlock() *BlockChain{
	//创建创世区块
	genisisBlock := CreateGenesisBlock("Genesis Data.......")
	//反回区块链对象
	return &BlockChain{[]*Block{genisisBlock}}
}